package com.lc.hongtai.adapter;

import android.content.Context;
import android.net.Uri;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.lc.hongtai.MyApplication;
import com.lc.hongtai.R;
import com.zcx.helper.bound.BoundViewHelper;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/4/21.
 */

public class JIaxiAdapter extends RecyclerView.Adapter<JIaxiAdapter.ViewHolder> {

    private Context context;
    private List<String> list;


    public JIaxiAdapter(Context context, List<String> list) {
        this.context = context;
        this.list = list;

    }

    public static class ViewHolder extends RecyclerView.ViewHolder {

        @Bind(R.id.text_title)
        TextView tv_02;

        @Bind(R.id.iv_camera)
        SimpleDraweeView iv_camera;

        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }


    @Override
    public JIaxiAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = BoundViewHelper.boundView(this, MyApplication.scaleScreenHelper.loadView((ViewGroup) LayoutInflater.from(parent.getContext())
                .inflate(R.layout.item_jiaxi, null)));

        JIaxiAdapter.ViewHolder vh = new JIaxiAdapter.ViewHolder(view);

        return vh;
    }

    @Override
    public void onBindViewHolder(JIaxiAdapter.ViewHolder holder, final int position) {
        holder.tv_02.setText(list.get(position));

        holder.iv_camera.setImageURI(Uri.parse("http://pic6.huitu.com/res/20130116/84481_20130116142820494200_1.jpg"));

    }


    @Override
    public int getItemCount() {
        return list.size();
    }
}
